<%-- 
    Document   : cadEPI
    Created on : 11/03/2011, 15:36:13
    Author     : UpTech
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!-- Declaração das Tags da biblioteca RichFaces -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <style>.cols{
            vertical-align:top;
        }
    </style>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link href="../../css/estilomodelo.css" rel="stylesheet" type="text/css" />

            <title>ENTRADA DE EPI | Sistema Gestão de Suprimentos - SGS WEB 1.0</title>
        </head>
        <body>
            <div id="container">
                <div id="banner">
                </div><%--Banner--%>

                <div  id="conteudoCad">
                    <a4j:form id="formCadEpi">
                        <rich:panel style="width:755px; height:200px; background-color:#FFFFFF;">
                            <f:facet name="header">
                                <h:outputText value="Entrada de EPI"  ></h:outputText>
                            </f:facet>
                            <h:panelGrid columns="4">
                                <h:outputText value="EPI: "/>
                                <h:inputText id="epi"  value="#{ObjFacadeEpi.epi}" required="true" size="20"/>
                                <a4j:commandButton value="Pesquisar" image="../../imagens/icon/listar.gif" onclick="Richfaces.showModalPanel('mp');"/>
                                <h:message for="epi"/>


                                <h:outputText value="CA: "/>
                                <h:inputText id="ca" value="#{ObjFacadeEpi.epi.ca}"  required="true" size="20" />
                                <rich:message for="ca"/><br>

                                <h:outputText value="Lote: "/>
                                <h:inputText id="lote" value="#{ObjFacadeEpi.epi.lote}"  required="true" size="20"/>
                                <h:message for="lote"/><br>

                                <h:outputText value="Quantidade: "/>
                                <h:inputText id="quantidade" value="#{ObjFacadeEpi.epi.quantidade}"  required="true" size="20"/>
                                <h:message for="quantidade"/><br>

                                <a4j:commandButton value="Gravar Entrada" action="#{ObjFacadeEpi.cadastrarEpi}" />
                            </h:panelGrid>

                        </rich:panel>
                    </a4j:form>

                    <%--Inicio do MODALPANEL--%>
                    <rich:modalPanel  id="mp" minHeight="200" minWidth="470"
                                      height="200" width="620">
                        <f:facet name="header">
                            <h:outputText value="Lista de EPI" />
                        </f:facet>
                        <f:facet name="controls">
                            <h:panelGroup>
                                <a4j:commandButton value="fechar" id="fechar" reRender="forCadEpi" onclick="javascript:Richfaces.hideModalPanel('mp')" image="../../imagens/icon/close.gif"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:form id="formDt">
                            <rich:dataTable align="center" style="width:600px;" id="suprimento" border="1" value="#{ObjDAO.allSuprimentoBeEpi}" rendered="#{not empty ObjDAO.allSuprimentoBeEpi}"  var="s" rows="4">
                                <f:facet name="header">
                                    <rich:columnGroup>
                                        <rich:column colspan="5" >
                                        </rich:column>
                                        <rich:column breakBefore="true">
                                            <h:outputText value="Inserir"/>
                                        </rich:column>
                                        <rich:column>
                                            <h:outputText value="Discriminação"/>
                                        </rich:column>
                                        <rich:column>
                                            <h:outputText value="Unidade"/>
                                        </rich:column>
                                        <rich:column>
                                            <h:outputText value="Marca"/>
                                        </rich:column>
                                        <rich:column>
                                            <h:outputText value="Tipo"/>
                                        </rich:column>
                                    </rich:columnGroup>
                                </f:facet>
                                <rich:column>
                                    <center>
                                        <a4j:commandButton value="Inserir" id="inserir" reRender="formCadEpi"  onclick="javascript:Richfaces.hideModalPanel('mp')" image="../../imagens/icon/alterar.gif" ></center>
                                            <f:setPropertyActionListener target="#{ObjFacadeEpi.epi.suprimento}" value="#{s}"/>
                                        </a4j:commandButton>
                                    </rich:column>
                                    <rich:column filterBy="#{s.discriminacao}" filterEvent="onkeyup" filterValue="">
                                        <h:outputText value="#{s.discriminacao}"/>
                                    </rich:column>

                                <rich:column filterBy="#{s.unidade}" filterEvent="onkeyup" filterValue="">
                                    <h:outputText value="#{s.unidade}"/>
                                </rich:column>

                                <rich:column filterBy="#{s.marca}" filterEvent="onkeyup" filterValue="">
                                    <h:outputText value="#{s.marca}"/>
                                </rich:column>

                                <rich:column filterBy="#{s.tipo}" filterEvent="onkeyup" filterValue="">
                                    <h:outputText value="#{s.tipo}"/>
                                </rich:column>
                                <f:facet name="footer">
                                    <rich:datascroller id="ds" renderIfSinglePage="false"></rich:datascroller>
                                </f:facet>

                            </rich:dataTable>
                        </h:form>
                    </rich:modalPanel>
                    <%--FIM MODALPANEL--%>                    
                </div><%--Conteúdo--%>
                <div align="center" id="tableCad">                    
                    <h:form>
                        <rich:dataTable style="width:740px;" id="epi" border="1" value="#{ObjDAO.allEpi}" rendered="#{not empty ObjDAO.allEpi}"  var="e" rows="4">
                            <h:column>
                                <f:facet name="header">
                                    < <h:outputText value="Excluir"/>
                                </f:facet>
                                <center> <h:commandButton value="excluir" action="#{ObjFacadeEpi.excluirEpi}" image="../../imagens/icon/excluir.gif"></center>
                                    <f:setPropertyActionListener target="#{ObjFacadeEpi.epi}" value="#{e}"/>
                                </h:commandButton>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Alterar"/>
                                </f:facet>
                                <center> <h:commandButton value="alterar" action="editar" image="../../imagens/icon/alterar.gif" ></center>
                                    <f:setPropertyActionListener target="#{ObjFacadeEpi.epi}" value="#{e}"/>
                                </h:commandButton>
                            </h:column>
                            <f:facet name="footer">
                                <rich:datascroller />
                            </f:facet>
                            <h:column>
                                <f:facet name="header">

                                    <h:outputText value="Id"/>
                                </f:facet>
                                <center> <h:outputText value="#{e.idEpi}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Epi"/>
                                </f:facet>
                                <center> <h:outputText value="#{e.epi}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="CA"/>
                                </f:facet>
                                <center> <h:outputText value="#{e.ca}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="lote"/>
                                </f:facet>
                                <center> <h:outputText value="#{e.lote}"/></center>
                            </h:column>

                        </rich:dataTable>
                    </h:form>
                </div><%--Tabela--%>
                <div id="rodapelogin">
                </div><%--Rodapé--%>
            </div><%--Container--%>
        </body>
    </html>
</f:view>

